﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Globalization;

namespace Elentok.Common.Wpf.ValueConverters
{
  /// <summary>
  /// Converts from <see cref="DateTime"/> to string (in current locale)
  /// </summary>
  public sealed class DateToCurrentLocaleConverter : IValueConverter
  {
    /// <summary>
    /// Converts from <see cref="DateTime"/> to string (in current locale)
    /// </summary>
    /// <param name="value"></param>
    /// <param name="targetType"></param>
    /// <param name="parameter"></param>
    /// <param name="culture"></param>
    /// <returns></returns>
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      DateTime date = (DateTime)value;

      return date.ToString(CultureInfo.CurrentCulture.DateTimeFormat);
    }

    /// <summary>
    /// NOT IMPLEMENTED
    /// </summary>
    /// <param name="value"></param>
    /// <param name="targetType"></param>
    /// <param name="parameter"></param>
    /// <param name="culture"></param>
    /// <returns></returns>
    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      throw new NotImplementedException();
    }
  }
}
